package com.ftf.tp.blog.application.eventHandler;

import com.ftf.tp.blog.domain.article.event.ColumnArticleUpdateEvent;
import com.ftf.tp.blog.domain.configuration.service.ColumnService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author tanghao
 * @date 2022/8/8
 */
@Slf4j
@Component
public class ColumnEventHandler {

    @Resource
    private ColumnService columnService;

    @Async("blogTaskExecutor")
    @EventListener
    public void handleEvent(ColumnArticleUpdateEvent event) {
        columnService.articleNumUpdate(event);
    }
}
